#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>

//https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836?tpId=37&&tqId=38366&rp=1&ru=/ta/huawei&qru=/ta/huawei/question-ranking

void InverseOderStr(char *str, int strSize) {
    int left = 0;
    int right = strSize - 1;
    while (left < right) {
        str[left] = str[left] ^ str[right];
        str[right] = str[left] ^ str[right];
        str[left] = str[left] ^ str[right];
        left++;
        right--;
    }
}

int main() {
    char str[1000];
    scanf("%[^\n]", str);
    int strSize = strlen(str);
    InverseOderStr(str, strSize);
    char *start = str;
    for (int i = 0; i <= strSize; i++) {
        if (!isalpha(str[i])) {
            str[i] = '\0';
            InverseOderStr(start, strlen(start));
            printf("%s ", start);
            start = str + i + 1;
        }
    }
    return 0;
}